package com.yzh.openai.infrastructure.dao;

import com.yzh.openai.infrastructure.po.UserAccountPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
* @description 针对表【user_account】的数据库操作Mapper
* @Entity com.yzh.openai.infrastructure.po.UserAccount
*/
@Mapper
public interface UserAccountMapper {
    /**
     * 查询用户信息
     * @param openid
     * @return
     */
    UserAccountPO queryUserInfo(String openid);
    /**
     * 增加额度
     * @param userAccount
     * @return
     */
    int addAccountQuota(UserAccountPO userAccount);
    /**
     * 查询用户
     * @param openid
     * @return
     */
    UserAccountPO queryUserAccount(String openid);

    /**
     * 扣减额度
     *
     * @param openid
     * @param cost
     * @return
     */
    int subAccountQuota(@Param("openid") String openid, @Param("cost") int cost);

    /**
     * 用户落库
     *
     * @param userAccount
     */
    int insertUserAccount(UserAccountPO userAccount);
}




